#include "LengthUnit.h"
#include <ostream>

const LengthUnit& INCH = LengthUnit::getINCH();
const LengthUnit& FEET = LengthUnit::getFEET();
const LengthUnit& YARD = LengthUnit::getYARD();
const LengthUnit& MILE = LengthUnit::getMILE();

LengthUnit* LengthUnit::baseUnit_m = NULL;

LengthUnit::LengthUnit(int ratio, std::string name):Unit(ratio, name) 
{
   if (ratio == 1)
     baseUnit_m = this;
}


LengthUnit & LengthUnit::getINCH()
{
   static LengthUnit inch(1,    "INCH" );
   return inch;
}

LengthUnit & LengthUnit::getFEET()
{
   static  LengthUnit feet(12,   "FEET" );
   return feet;
}

LengthUnit & LengthUnit::getYARD()
{
   static LengthUnit yard(36,   "YARD" );
   return yard;
}

LengthUnit & LengthUnit::getMILE()
{
   static LengthUnit mile(63360,"MILE");
   return mile;
}

LengthUnit & LengthUnit::baseUnit()
{
   return *baseUnit_m;
}

